//逻辑控制！！！！！

import javax.swing.text.html.FormSubmitEvent;
import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //猜数字游戏
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        int randnum = random.nextInt(101);//[0,101)
        while(true){
            System.out.println("请输入你要猜的数字：");
            int num = scanner.nextInt();
            if(num<randnum){
                System.out.println("猜小了！");
            }else if(num == randnum){
                System.out.println("恭喜你猜对了！");
                break;
            }else{
                System.out.println("猜大了！");
            }
        }
    }

    public static void main9(String[] args) {
        int i = 1;
        while(i<=100){
            if(i%3==0&&i%5==0){
                System.out.println(i);
                i++;
            }else{
                i++;
                continue;
            }
        }
    }
    public static void main8(String[] args) {
        int i = 1;
        while(i<=10){
            if(i==2){
                i++;
                continue;
            }
            System.out.println("hello");
            i++;
        }
    }
    public static void main7(String[] args) {
        int j = 1;
        int sum = 0;
        while(j<=5){
            int i = 1;
            int ret = 1;
            while(i<=j){
                ret *= i;
                i++;
            }
            sum += ret;
            j++;
        }
        System.out.println(sum);
    }
    public static void main6(String[] args) {
        //求5的阶乘
        int i = 1;
        int ret = 1;
        while(i<=5){
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }
    public static void main5(String[] args) {
        int addsum = 0;
        int evesum = 0;
        int i = 1;
        while(i<=100){
            if(i%2==0) {
                addsum += i;
                i++;
            }else{
                evesum += i;
                i++;
            }
        }
        System.out.println(addsum +"addsum");
        System.out.println(evesum +"osum");
    }
    public static void main4(String[] args) {
        int i = 1;
        while(i<=10){
            System.out.println(i);
            i++;
        }
    }

    //不能做switch的参数类型有哪些？->long,float,double,boolean,
    public static void main3(String[] args) {
        int a = 2;
        switch (a){
            case 1:
                System.out.println("1");
                break;
            case 2:
                System.out.println("2");
                break;
            default:
                System.out.println("输入错误");
                break;
        }
    }
    public static void main2(String[] args) {
        int x = 10;
        int y = 10;
        if(x == 20){
            if(y == 10){
                System.out.println("aaa");
            }else{
                System.out.println("bbb");
            }
        }
    }
    public static void main1(String[] args) {
        //if(布尔表达式：true or false)
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()){
            int year = scanner.nextInt();
            if(year % 100 == 0){
                if(year % 400 == 0){
                    System.out.println(year+"是闰年！");
                }else{
                    System.out.println(year+"不是闰年！");
                }
            }else{
                if (year % 4 == 0){
                    System.out.println(year+"是闰年！");
                }else{
                    System.out.println(year+"不是闰年！");
                }
            }
        }
    }
}
